package com.dao.model;

import java.sql.Timestamp;

/**
 * @author zyf
 */
public class TranData {

    private char id;
    private int type;
    private String txid;
    private String ccid;
    private String fun;
    private String funargs;
    private String blockid;
    private Timestamp timestamp;

    private TranData(Builder builder) {
        id = builder.id;
        type = builder.type;
        txid = builder.txid;
        ccid = builder.ccid;
        fun = builder.fun;
        funargs = builder.funargs;
        blockid = builder.blockid;
        timestamp = builder.timestamp;
    }

    public static Builder newBuilder() {
        return new Builder();
    }


    /**
     * {@code TranData} builder static inner class.
     */
    public static final class Builder {
        private char id;
        private int type;
        private String txid;
        private String ccid;
        private String fun;
        private String funargs;
        private String blockid;
        private Timestamp timestamp;

        private Builder() {
        }

        /**
         * Sets the {@code id} and returns a reference to this Builder so that the methods can be chained together.
         *
         * @param id the {@code id} to set
         * @return a reference to this Builder
         */
        public Builder setId(char id) {
            this.id = id;
            return this;
        }

        /**
         * Sets the {@code type} and returns a reference to this Builder so that the methods can be chained together.
         *
         * @param type the {@code type} to set
         * @return a reference to this Builder
         */
        public Builder setType(int type) {
            this.type = type;
            return this;
        }

        /**
         * Sets the {@code txid} and returns a reference to this Builder so that the methods can be chained together.
         *
         * @param txid the {@code txid} to set
         * @return a reference to this Builder
         */
        public Builder setTxid(String txid) {
            this.txid = txid;
            return this;
        }

        /**
         * Sets the {@code ccid} and returns a reference to this Builder so that the methods can be chained together.
         *
         * @param ccid the {@code ccid} to set
         * @return a reference to this Builder
         */
        public Builder setCcid(String ccid) {
            this.ccid = ccid;
            return this;
        }

        /**
         * Sets the {@code fun} and returns a reference to this Builder so that the methods can be chained together.
         *
         * @param fun the {@code fun} to set
         * @return a reference to this Builder
         */
        public Builder setFun(String fun) {
            this.fun = fun;
            return this;
        }

        /**
         * Sets the {@code funargs} and returns a reference to this Builder so that the methods can be chained together.
         *
         * @param funargs the {@code funargs} to set
         * @return a reference to this Builder
         */
        public Builder setFunargs(String funargs) {
            this.funargs = funargs;
            return this;
        }

        /**
         * Sets the {@code blockid} and returns a reference to this Builder so that the methods can be chained together.
         *
         * @param blockid the {@code blockid} to set
         * @return a reference to this Builder
         */
        public Builder setBlockid(String blockid) {
            this.blockid = blockid;
            return this;
        }

        /**
         * Sets the {@code timestamp} and returns a reference to this Builder so that the methods can be chained together.
         *
         * @param timestamp the {@code timestamp} to set
         * @return a reference to this Builder
         */
        public Builder setTimestamp(Timestamp timestamp) {
            this.timestamp = timestamp;
            return this;
        }

        /**
         * Returns a {@code TranData} built from the parameters previously set.
         *
         * @return a {@code TranData} built with parameters of this {@code TranData.Builder}
         */
        public TranData build() {
            return new TranData(this);
        }

        public char getId() {
            return id;
        }

        public int getType() {
            return type;
        }

        public String getTxid() {
            return txid;
        }

        public String getCcid() {
            return ccid;
        }

        public String getFun() {
            return fun;
        }

        public String getFunargs() {
            return funargs;
        }

        public String getBlockid() {
            return blockid;
        }

        public Timestamp getTimestamp() {
            return timestamp;
        }
    }
}
